const { DataSource } = require('typeorm');

async function checkTimestamps() {
    const dataSource = new DataSource({
        type: 'mysql',
        host: '43.143.253.188',
        port: 3306,
        username: 'nextjs',
        password: 'jack666',
        database: 'nextjs',
        entities: [],
        synchronize: false,
        logging: false
    });

    try {
        await dataSource.initialize();
        console.log('✅ 数据库连接成功');

        console.log('🔍 检查casino_dice_bets表的时间戳...');
        const bets = await dataSource.query('SELECT id, created_at, updated_at FROM casino_dice_bets ORDER BY id DESC LIMIT 5');

        console.log('📊 最近5条下注记录的时间戳:');
        bets.forEach((bet, index) => {
            console.log(`${index + 1}. ID: ${bet.id}`);
            console.log(`   创建时间: ${bet.created_at}`);
            console.log(`   更新时间: ${bet.updated_at}`);
            console.log('');
        });

        console.log('🔍 检查casino_dice_rounds表的时间戳...');
        const rounds = await dataSource.query('SELECT id, created_at, updated_at FROM casino_dice_rounds ORDER BY id DESC LIMIT 3');

        console.log('📊 最近3条期数记录的时间戳:');
        rounds.forEach((round, index) => {
            console.log(`${index + 1}. ID: ${round.id}`);
            console.log(`   创建时间: ${round.created_at}`);
            console.log(`   更新时间: ${round.updated_at}`);
            console.log('');
        });

    } catch (error) {
        console.error('❌ 错误:', error.message);
    } finally {
        await dataSource.destroy();
    }
}

checkTimestamps();
